#pragma once

#include "resource_handle.hpp"

namespace winboost {
   namespace resources {

struct deleter_window
{
   void operator()(HWND h)  { ::DestroyWindow(h); }
};

class win_handle : public resource_handle<HWND__>
{
public:
   win_handle(void);
   virtual ~win_handle(void);

   virtual void subclass_window(value_type hwnd) {}
   virtual void pre_subclass(value_type hwnd){}
   virtual bool is_dialog(void) const { return false; }
   
   void allocate(value_type hwnd);
   u_string get_class() const { return m_class; }
   void set_class(u_string val) { m_class = val; }

protected:
   u_string m_class; // window class
   ATOM m_class_atom;
   
};

inline win_handle::win_handle(void):
  m_class(_T("winboost_class"))
, m_class_atom(0)
{
}

inline win_handle::~win_handle(void)
{
}

inline void win_handle::allocate(value_type hwnd)
{
   m_handle = handle_type(hwnd, deleter_window());
}

   }
}
